﻿/**
 * 
 */
var xhr;
function checkPwd() {
	//alert("密码");
	xhr = new XMLHttpRequest();
	var name = document.getElementById("name_i").value;
	var pwd = document.getElementById("opwd").value;
	var uri = "user!checkPwd.action?name="+name+"&pwd="+pwd;
	xhr.open("post", uri, true);
	xhr.onreadystatechange = testPwd;
	xhr.send();
}
			
function testPwd() {
	//服务器端已经成功交互，并且成功返回数据的时候！
	if(xhr.readyState == 4 && xhr.status == 200 ) {
		var res = xhr.responseText;   //获取服务器端传回的数据。
		var resp = eval("("+res+")");
		var pwd_e = document.getElementById("pwd_e");
					
		if(resp) {
			pwd_e.innerHTML = "密码正确";
		}else {
			pwd_e.innerHTML = "密码错误";
		}
	}
}

function checkPwd_() {
	var pwd = document.getElementById("pwd").value;
	var rpwd = document.getElementById("rpwd").value;
	var rpwd_i = document.getElementById("rpwd_i");
	var button = document.getElementById("button");
	//alert(pwd == rpwd);
	if(pwd == rpwd) {
		rpwd_i.innerHTML ="密码一致";
		button.removeAttribute('disabled');
	}
	else {
		rpwd_i.innerHTML ="密码不一致";
		button.disabled='true';
	}
}